
using System;
using System.Threading;

using Derm.Render;
using Derm.Xml;

namespace Derm.Examples
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			log4net.Config.XmlConfigurator.Configure();
				;            
			//Application.EnableVisualStyles();
			//Application.SetCompatibleTextRenderingDefault(false);

			// Required for loading XML
			XmlHelper.AddXmlSchemaSearchPath("../../../../Derm/Xml/Schemas");

			// Define window
			RenderWindow rWindow = new RenderWindow(1024, 768);
			RenderSurfaceFormat renderWindowFormat = new RenderSurfaceFormat();

			renderWindowFormat.DefineColorBuffer(Pixel.Type.RGB24);
			renderWindowFormat.DefineDepthBuffer(24);
			renderWindowFormat.DefineDoubleBuffers();

			rWindow.Create(renderWindowFormat);
			rWindow.ShowWindow();

			// Define render pipeline
			ExamplePipeline rPipeline = new ExamplePipeline(rWindow);
			// Create kernel
			sMainRenderKernel = new RenderKernel();
			sMainRenderKernel.RegisterPipeline(rPipeline);
			RenderKernel.RegisterKernel(sMainRenderKernel);

			// Run for 10 seconds the "ColoredUnitCube"
			rPipeline.SetExample("ColoredUnitCube");
			RenderKernel.RunKernels();
			Thread.Sleep(10000);

			RenderKernel.StopKernels();
		}

		/// <summary>
		/// Application render kernel.
		/// </summary>
		private static RenderKernel sMainRenderKernel;
	}
}